home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / layout / nsChangeHint.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  5KB  |  116 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37. #ifndef nsChangeHint_h___
  38. #define nsChangeHint_h___
  39.  
  40. #include "prtypes.h"
  41.  
  42. // Defines for various style related constants
  43.  
  44. enum nsChangeHint {
  45.   nsChangeHint_RepaintFrame = 0x01,  // change was visual only (e.g., COLOR=)
  46.   nsChangeHint_ReflowFrame = 0x02,   // change requires reflow (e.g., WIDTH=)
  47.   nsChangeHint_SyncFrameView = 0x04, // change requires view to be updated, if there is one (e.g., clip:)
  48.   nsChangeHint_UpdateCursor = 0x08,  // The currently shown mouse cursor needs to be updated
  49.   nsChangeHint_ReconstructFrame = 0x10   // change requires frame change (e.g., display:)
  50.                                          // This subsumes all the above
  51.   // TBD: add nsChangeHint_ForceFrameView to force frame reconstruction if the frame doesn't yet
  52.   // have a view
  53. };
  54.  
  55. #ifdef DEBUG_roc
  56. // Redefine these operators to return nothing. This will catch any use
  57. // of these operators on hints. We should not be using these operators
  58. // on nsChangeHints
  59. inline void operator<(nsChangeHint s1, nsChangeHint s2) {}
  60. inline void operator>(nsChangeHint s1, nsChangeHint s2) {}
  61. inline void operator!=(nsChangeHint s1, nsChangeHint s2) {}
  62. inline void operator==(nsChangeHint s1, nsChangeHint s2) {}
  63. inline void operator<=(nsChangeHint s1, nsChangeHint s2) {}
  64. inline void operator>=(nsChangeHint s1, nsChangeHint s2) {}
  65. #endif
  66.  
  67. // Operators on nsChangeHints
  68.  
  69. // Merge two hints, taking the union
  70. inline nsChangeHint NS_CombineHint(nsChangeHint aH1, nsChangeHint aH2) {
  71.   return (nsChangeHint)(aH1 | aH2);
  72. }
  73.  
  74. // Merge two hints, taking the union
  75. inline nsChangeHint NS_SubtractHint(nsChangeHint aH1, nsChangeHint aH2) {
  76.   return (nsChangeHint)(aH1 & ~aH2);
  77. }
  78.  
  79. // Merge the "src" hint into the "dst" hint
  80. // Returns true iff the destination changed
  81. inline PRBool NS_UpdateHint(nsChangeHint& aDest, nsChangeHint aSrc) {
  82.   nsChangeHint r = (nsChangeHint)(aDest | aSrc);
  83.   PRBool changed = (int)r != (int)aDest;
  84.   aDest = r;
  85.   return changed;
  86. }
  87.  
  88. // Returns true iff the second hint contains all the hints of the first hint
  89. inline PRBool NS_IsHintSubset(nsChangeHint aSubset, nsChangeHint aSuperSet) {
  90.   return (aSubset & aSuperSet) == aSubset;
  91. }
  92.  
  93. // Redefine the old NS_STYLE_HINT constants in terms of the new hint structure
  94. #define NS_STYLE_HINT_NONE \
  95.   nsChangeHint(0)
  96. #define NS_STYLE_HINT_VISUAL \
  97.   nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView)
  98. #define NS_STYLE_HINT_REFLOW \
  99.   nsChangeHint(NS_STYLE_HINT_VISUAL | nsChangeHint_ReflowFrame)
  100. #define NS_STYLE_HINT_FRAMECHANGE \
  101.   nsChangeHint(NS_STYLE_HINT_REFLOW | nsChangeHint_ReconstructFrame)
  102.  
  103.  
  104. /**
  105.  * |nsReStyleHint| is a bitfield for the result of |HasStateDependentStyle|
  106.  * and |HasAttributeDependentStyle|.  All values have an implied "and
  107.  * descendants."  When no restyling is necesary, use |nsReStyleHint(0)|.
  108.  */
  109. enum nsReStyleHint {
  110.   eReStyle_Self = 0x1,
  111.   eReStyle_LaterSiblings = 0x2
  112. };
  113.  
  114.  
  115. #endif /* nsChangeHint_h___ */
  116.